{include file="header.html"}
<script type="text/javascript">

$(function(){
    $('#acategory_form').validate({
//     	 errorPlacement: function(error, element){
//              $(element).next('.noerror').hide();          
//              $(element).after(error);
//          },
//          success       : function(element){
//          	 $(element).next('.noerror').show();  
//          	 $(element).remove();
         	
//          },
//          rules : {    
//         	 m_order : {
//                  required : true
//              },
//              m_required_service_date :{
//                  required : true
//              },
//              m_minspeed :{
//                  required : true
//              },
//              m_maxspeed :{
//                  required : true
//              },
//              m_required_leave_date :{
//                  required : true
//              },
           
  
//          },
//          messages : {
//         	 m_order : {
//                  required : '必填'
//              },
//              m_required_service_date : {
//                  required : '必填'
//              },
//              m_minspeed : {
//                  required : '必填'
//              },
//              m_maxspeed : {
//                  required : '必填'
//              },
//              m_required_leave_date : {
//                  required : '必填'
//              },
      
//          }
    });
    $("#m_type").change(function(){
    	if($(this).val()=='速度监控'){
    		$("[id^='id_sudushow_']").show();
    		$("[id^='id_suduhide_']").hide();
    	}else{
    		$("[id^='id_sudushow_']").hide();
    		$("[id^='id_suduhide_']").show();
    	}
    });
    
    if($("#m_lng").val()&&$("#m_lat").val()){
    	
    	$("#m_lng_lat").val($("#m_lng").val()+'，'+$("#m_lat").val());
    }
    
    $("#btn1").click(function(){
    
     	 if(confirm("确定要审核吗？"))
    	 {
    		 window.location.href="index.php?app=tutor&act=checked&id={$id}";
    	 }
  
    });
    $("#m_type").change();
    
    $("#btn2").click(function(){
        
    	 if(confirm("确定要取消审核吗？"))
    	 {
    		 window.location.href= "index.php?app=tutor&act=nochecked&id={$id}";
    	 }
    	  
    });
    $('#m_required_leave_date').datetimepicker({changeMonth: true,changeYear: true});
    $('#m_required_service_date').datetimepicker({changeMonth: true,changeYear: true});
    
});

var l=10000;

var mainid=0;
var mapsender=null;
var maptype;
	//地图选择
	function mapselect(mapid,id,sender,type){
		mainid=id;
		mapsender=sender;
		maptype=type;
		$w=$(window).width();
		$h=$(window).height();
		$w=$w*0.7;

        if(maptype==1){
			
        	$("#mapframe").attr("src","index.php?app=map&act=mapselect&lng="+parseFloat($("[id='m_lng']").val())+"&lat="+parseFloat($("[id='m_lat']").val())+"&ret=window.parent.mapresult&address="+'{$auth.g_loading_place}');

		}
		

		$("#mapframe").width($w);
		$.colorbox({
			width : $w+20,
			height : "650px",
			inline : true,
			href : "#maplist"
		});
	}
	
	function timeimg (type,number,id){
		
		if(type==1){
			if(number==1){
				$('#m_required_service_date'+id).focus();
			}else if(number==2){
				$('#m_required_leave_date'+id).focus();
			}
		}
	}
	
	
	
	function mapresult(lng,lat){
		$('mapframe').colorbox.close();
	
		if(maptype==1){
			
			$("#m_lat").val(lat);
			$("#m_lng").val(lng);
			
		}

	
		if(mapsender!=null){
			$(mapsender).html()
		}
		
		

		if($("#m_lat").val()>0&&$("#m_lng").val()>0){
			$("#mimg").attr("src","templates/images/newadmin/map1.png");
		}
		$("#m_lng_lat").val($("#m_lng").val()+'，'+$("#m_lat").val());
	
		
	}


</script>

<div style="display: none"  >
	<div id="maplist">
		<iframe id="mapframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>



<div id="rightTop">
    <p>监控</p>
    <ul class="subnav">
      <li><a class="btn1" href="index.php?app=monitor_main&amp;act=edit&amp;id={$id}">监控方案</a></li>
        <li><span>编辑</span></li>
    </ul>
</div>

<div class="info">
    <form method="post" enctype="multipart/form-data" id="acategory_form">
      	<table class="infoTable">

				<tr>
					<th class="paddingT15">监控类型:</th>
					<td>
						<select   class="infoTableInput" name="m_type" id="m_type">
					   {html_options options=$typelist selected=$monitor.m_type}</select>
					</td>
					<th class="paddingT15">监控顺序:</th>
					<td>
						<input type="text" name="m_order" value="{$monitor.m_order}" class="infoTableInput" id="zmm_name" >
					</td>
					<th class="paddingT15" id="id_suduhide_44">监控点经纬度:</th>
					<input type="hidden" name="m_lng"
					value="{$monitor.m_lng}" 
					class="infoTableInput" id="m_lng">
					
						<input type="hidden" name="m_lat"
					value="{$monitor.m_lat}" 
					class="infoTableInput" id="m_lat">
					
					<td id="id_suduhide_45">
						<input type="text" style="background: #d7d7d7;" name="m_lng_lat" value=""  class="infoTableInput grayb" readonly="readonly" id="m_lng_lat" >
						
                     <a href="javascript:void(0);"
					onclick="mapselect('#haul_{$auth.g_tid}_h_address','{$auth.g_tid}','',1);"
					class="right_a" > 
					{if $monitor.m_lat>0&&$monitor.m_lng}<img id='mimg' src="templates/images/newadmin/map1.png" alt="" id="mapimg_{$h.h_tid}">{else}<img id='mimg' src="templates/images/newadmin/map.png" alt="" id="mapimg_{$h.h_tid}">{/if}</a>
					</td>
				</tr>
				<tr>
					<th class="paddingT15" id="id_suduhide_3">要求到达时间:</th>
					<td class="paddingT15 wordSpacing5" id="id_suduhide_4">
						<input type="text" name="m_required_service_date" value="{$monitor.m_required_service_date|date:Y-m-d H:i}"  class="infoTableInput" id="m_required_service_date" >
						<a href="javascript:void(0);" onclick="timeimg('1','1','');" class="right_a"><img src="templates/images/newadmin/rili.png" alt=""></a>
					</td>
				   <th class="paddingT15" id="id_sudushow_5">最小速度:</th>
					<td id="id_sudushow_6">
						<input type="text" name="m_minspeed" value="{$monitor.m_minspeed}" class="infoTableInput" >
					</td>
					<th class="paddingT15" id="id_sudushow_7">最大速度:</th>
					<td id="id_sudushow_8">
						<input type="text" name="m_maxspeed" value="{$monitor.m_maxspeed}" class="infoTableInput" >

					</td>
					<th class="paddingT15" id="id_suduhide_9">要求离开时间:</th>
					<td class="paddingT15 wordSpacing5" id="id_suduhide_10">
						<input type="text" name="m_required_leave_date" value="{$monitor.m_required_leave_date|date:Y-m-d H:i}"  class="infoTableInput" id="m_required_leave_date" >
						<a href="javascript:void(0);" onclick="timeimg('1','2','');" class="right_a"><img src="templates/images/newadmin/rili.png" alt=""></a>
					</td>
					<th class="paddingT15" id="id_suduhide_11">离开偏差/(米):</th>
					<td id="id_suduhide_12">
						<input type="text" name="m_leave_offset" value="{$monitor.m_leave_offset}" class="infoTableInput">
					</td>
				</tr>
				<tr>
					<th class="paddingT15">间隔时间/(秒):</th>
					<td>
					    <input type="text" name="m_check_interval" value="{$monitor.m_check_interval}" class="infoTableInput" id="m_check_interval" >
					</td>
				</tr>
				<tr>
					<th class="paddingT15">备注:</th>
					<td      class="paddingT15 wordSpacing5" colspan="1">
						<textarea name="m_note" id="m_note" rows="3" style="width: 100%;" >{$monitor.m_note}</textarea>
					</td>
				</tr>
				<tr >
				<td class="ptb20" colspan="7" style="text-align:center;">
				 <input class="formbtn" align="right" type="submit" name="Submit" value="{$lang.submit}" />
           
				</td>
				</tr>
				
			</table>
    </form>
</div>

{include file="footer.html"}